package com.zjuh.goodboy.config;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class DefaultConfiguration implements Configuration {

	private Map<String, String> properties = new HashMap<String, String>();
	
	private Map<String, Class<?>> namedClasses = new HashMap<String, Class<?>>();
	
	private Map<String, List<Class<?>>> namedClassList = new HashMap<String, List<Class<?>>>();
	
	@SuppressWarnings("unchecked")
	public void addNamedClassList(String name, Object classList) {
		namedClassList.put(name, (List<Class<?>>)classList);
	}
	
	public void addNamedClass(String name, Class<?> clazz) {
		namedClasses.put(name, clazz);
	}
	
	@Override
	public Map<String, List<Class<?>>> getNamedClassList() {
		return namedClassList;
	}

	@Override
	public Map<String, Class<?>> getNamedClasses() {
		return namedClasses;
	}
	
	public void addProperty(String name, String value) {
		properties.put(name, value);
	}

	public String getProperty(String name) {
		return properties.get(name);
	}
	
	@Override
	public String getProperty(String name, String defaultValue) {
		if (properties.containsKey(name)) {
			return properties.get(name);
		}
		return defaultValue;
	}

	@Override
	public Set<String> getPropertyNames() {
		return properties.keySet();
	}

}
